﻿using CatUtils.Utils.Currency.IoUtils;
using CatUtils.Utils.SpecialUtils.View;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Service_monitoring.Utils.MailHelper.HelperView
{
    public partial class SetTokenForm : Form
    {
        public SetTokenForm()
        {
            InitializeComponent();
        }

        private string TempFilePath = "";

        public SetTokenForm(string TipText, string SaveFilePath)
        {
            InitializeComponent();
            label1.Text = TipText;
            TempFilePath = SaveFilePath;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SaveHelper();
        }

        private void SaveHelper()
        {
            if (TempFilePath == "")
            {
                MessageHelper.Alert("非常规启动，关闭。");
                Close();
            }
            else if (textBox1.Text == "")
            {
                MessageHelper.Alert("请设置token。");
                return;
            }
            FileHelper.WriteText(TempFilePath, textBox1.Text);
            Close();
        }
    }
}